import math
import pickle
# from matplotlib.axes._axes import _log as matplotlib_axes_logger
from matplotlib import pyplot as plt
import random
import numpy as np

def main3():

    with open(".bigpic_data.pk",'rb') as f:
        embedd_lss,big_num_lists,big_key_lists,path=pickle.load(f)
    print("All data save DONE.")


    plot3(embedd_lss,big_num_lists,big_key_lists,path)
    print("everything done.")

def plot3(embeddlss,bignumls,bigkeyls,path):
    print(bignumls)
    print(embeddlss)
    clist=[[255,0,0],[0,255,0],[0,0,255]]
    clist=["r","g","b"]
    marker=["o","^","s"]
    plt.figure(dpi=200)
    plt.rcParams["font.sans-serif"]=['KaiTi']
    plt.rcParams['axes.unicode_minus']=False
    for i,alist in enumerate(embeddlss):
        # color_R=random.random()
        # color_G=random.random()
        # color_B=random.random()
        for j, element in enumerate(alist):
            size=int(math.log2(bignumls[i][j]*20+1.0)*50+10)
            plt.scatter(element[0],element[1],
                        marker=marker[i],s=size,Alpha=0.5,
                        c=clist[i])
            # plt.annotate(bigkeyls[i][j],xy=(element[0],element[1]),xytext=(element[0],element[1]))
            plt.text(element[0],element[1],bigkeyls[i][j],fontsize=5,c=clist[i])

    plt.savefig(path)
    plt.show()

if __name__=="__main__":
    main3()
